﻿using Microsoft.Office.Interop.Word;

namespace Songhay.Office2010.Word
{
    using Songhay;
    using Songhay.Models;

    /// <summary>
    /// Defines commands used in Office Word Solutions.
    /// </summary>
    public interface IOfficeWordCommand
    {
        /// <summary>
        /// Gets or sets the name
        /// (non-unique key)
        /// for locating this command
        /// in a collection of commands.
        /// </summary>
        /// <value>The name.</value>
        /// <remarks>
        /// Conventional command name prefixes:
        /// Startup* Commands with this prefix will be executed during the ThisAddIn_Startup event.
        /// Shutdown* Commands with this prefix will be executed during the ThisAddIn_Shutdown event.
        /// </remarks>
        string Name { get; set; }

        /// <summary>
        /// Executes the command.
        /// </summary>
        /// <typeparam name="TMessage">The type of the message.</typeparam>
        /// <param name="wordApplication">The word application.</param>
        /// <param name="message">The message.</param>
        void ExecuteCommand<TMessage>(Application wordApplication, TMessage message) where TMessage : IControlInteractionMessage;

        /// <summary>
        /// Executes the command and returns a value
        /// to be bound to the UI.
        /// </summary>
        /// <typeparam name="TMessage">The type of the message.</typeparam>
        /// <param name="wordApplication">The word application.</param>
        /// <param name="message">The message.</param>
        object ExecuteCommandForBinding<TMessage>(Application wordApplication, TMessage message) where TMessage : IControlInteractionMessage;
    }
}
